<!DOCTYPE html>
<html>
<head>
    {include file='public/meta'/}
    <link rel="stylesheet" type="text/css" href="__STATIC_URL__/static/css/bootstrap-datetimepicker.css"/>
    <link rel="stylesheet" type="text/css" href="__STATIC_URL__/static/css/tidy.css">


    <script src="__STATIC_URL__/static/js/bootstrap-datetimepicker.js" type="text/javascript" charset="utf-8"></script>
    <script src="__STATIC_URL__/static/laydate/laydate.js"></script>
    <script src="__STATIC_URL__/static/js/times.js"></script>

</head>
<body>
{include file='public/header'/}
<!------------------导航-------------------------->
<section id="content">
    {include file='public/left'/}
    <!--------------------------主要内容区域------------------------------------->
    <div class="content" >
        <div class="page-heading mgl15 mgr15">
            <!--路径导航-->
            <ol class="breadcrumb">
                <li>当前位置是:</li>
                <li>
                    <a href="javascript:;">会员卡管理</a>
                </li>
                <li>
                    <a href="{:url('cardus/carduslist')}">会员卡列表</a>
                </li>
                <li>
                    <a href="javascript:history.back();">会员列表</a>
                </li>
                <li class="active">会员余额变更明细</li>
            </ol>

        </div>
        <div class="panel panel-default panel-search mgl15 mgr15">
            <div class="panel-heading">
                <h5 class="panel-title"><span class="glyphicon glyphicon-search pull-left" style="margin-right: 10px;"></span>查找</h5>
            </div>
            <div class="panel-body">
                <form action="" method="get" class="form-horizontal table-search form-search" role="form" id="machform">
                    <div class="col-sm-6 col-md-6 col-lg-4 ">
                        <div class="form-group">
                            <label class="col-sm-3 control-label">类型：</label>
                            <div class="col-sm-9">
                                <select name="type"  class="form-control">
                                    <option value="">请选择</option>
                                    <option value="2" {if condition="$p_data['type'] eq 2"} selected {/if}>核销</option>
                                    <option value="1" {if condition="$p_data['type'] eq 1"} selected {/if}>充值</option>
                                </select>
                            </div>
                        </div>
                    </div>
                    <div class="col-sm-6 col-md-6 col-lg-4 ">
                        <div class="form-group">
                            <label class="col-sm-3 control-label">方式：</label>
                            <div class="col-sm-9">
                                <select name="hx_fs" class="form-control">
                                    <option value="">请选择</option>
                                    <option value="小程序" {if condition="$p_data['hx_fs'] eq '小程序'"} selected {/if}>小程序</option>
                                    <option value="客户端" {if condition="$p_data['hx_fs'] eq '客户端'"} selected {/if}>客户端</option>
                                    <option value="WEB后台" {if condition="$p_data['hx_fs'] eq 'WEB后台'"} selected {/if}>WEB后台</option>
                                </select>
                            </div>
                        </div>
                    </div>
                    <div class="col-sm-6 col-md-6 col-lg-4">
                        <div class="form-group">
                            <label class="col-sm-3 control-label">时间：</label>
                            <div class="col-sm-9">
                                <input name="search_date" type="text" value=""  readonly="readonly" id="search_date" placeholder="请选择" class="form-control">

                            </div>
                        </div>
                    </div>
                </form>
            </div>
            <div class="panel-footer">
                <a href="javascript:;" class="btn btn-primary" onclick="searchform()">查找</a>
                <a href="javascript:;" class="btn btn-default" onclick="clearform()">清空</a>
            </div>

        </div>
        <div class="panel mgl15 mgr15" >
            <div class="panel-heading addCharts" style="background:#ededed;">余额明细 </div>
            <div class="panel-body">
                <table class="table table-bordered">
                    <thead>
                    <th>编号</th>
                    <th>会员卡名称</th>
                    <th>卡号</th>
                    <th>门店</th>
                    <th>金额</th>
                    <th>赠券</th>
                    <th>类型</th>
                    <th>核销员</th>
                    <th>方式</th>
                    <th>时间</th>
                    </thead>
                    <tbody>
                    {volist name="list" id="vo"}
                    <tr>
                        <td>{$vo.id}</td>
                        <td><a href="{:url('cardus/cardinfo',['card_id'=>$vo['card_id']])}" class="btn-link">{$vo.card_id|getcardtitle=###,1}</a></td>
                        <td>{$vo.code}</td>
                        <td>{$vo.mid|getmachnames}</td>

                        <td>{neq name="vo.add_balance" value="0"}+{$vo.add_balance}(充值:{$vo['pay_balance']}赠送:{$vo['add_balance']-$vo['pay_balance']}){else/}-{$vo.del_balance}{/neq}</td>
                        <td>{:getgiveidcard($vo['giveid'],0)}</td>
                        <td>{$vo.type|getupdatetype=###}</td>
                        <th>{$vo.con_username}</th>
                        <th>
                            {$vo.hx_fs|getpayfs=###}
                        </th>
                        <td>{$vo.create_time}</td>
                    </tr>
                    {/volist}
                    </tbody>

                </table>
            </div>
            {$list->render()}
        </div>
        {include file='public/footer'/}
    </div>
</section>
<script>
    $(function (){
        //        搜索时间选择
        $('#starttime').datetimepicker({
            minView: "month", //选择日期后，不会再跳转去选择时分秒
            language: 'zh-CN',
            format: 'yyyy-mm-dd',
            todayBtn: 1,
            autoclose: 1,
            todayHighlight: true,
            endDate:new Date()
        }).on('changeDate', function (ev) {
            var starttime = $('#starttime').val();
            var endtime = $('#endtime').val();
            if (starttime != "" && endtime != "") {
                var startD = new Date(Date.parse(starttime.replace(/-/g, "/")));
                var endD = new Date(Date.parse(endtime.replace(/-/g, "/")));
                if (endtime < starttime) {
                    $('#starttime').val('');
                    alert('结束时间必须大于大于时间');
                    return;
                }
                ;
                $("#endtime").datetimepicker('setStartDate', starttime);
                $("#starttime").datetimepicker('hide');
            }
        });
        $('#endtime').datetimepicker({
            minView: "month", //选择日期后，不会再跳转去选择时分秒
            language: 'zh-CN',
            format: 'yyyy-mm-dd',
            todayBtn: 1,
            autoclose: 1,
            todayHighlight: true,
            endDate:new Date()
        }).on('changeDate', function (ev) {
            var starttime = $('#starttime').val();
            var endtime = $('#endtime').val();
            if (starttime != "" && endtime != "") {
                var startD = new Date(Date.parse(starttime.replace(/-/g, "/")));
                var endD = new Date(Date.parse(endtime.replace(/-/g, "/")));
                if (endtime < starttime) {
                    $('#endtime').val('');
                    alert('结束时间必须大于开始时间');
                    return;
                }
                $("#starttime").datetimepicker('setEndDate', endtime);
                $("#endttime").datetimepicker('hide');
            }
        });
    })
</script>
</body>


</html>
